/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.form.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;



import com.hera.base.domain.BaseDomain;
import com.hera.process.config.domain.ParameterDetail;
import com.hera.process.workflow.domain.Stage;

/**
 *
 * @author cmontes
 */
@Entity
@Table(name = "DYNAFORM_STAGE")
public class DynaformStage  extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DynaformStagePK dynaformStagePK;
    private Integer secuence;
    /*@Column(name = "ID_MODE")
    private BigInteger idMode;*/
    @ManyToOne
    @JoinColumn(name="ID_MODE")
    private ParameterDetail mode;
    @JoinColumn(name = "ID_STAGE", referencedColumnName = "ID_STAGE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Stage stage;
    @JoinColumn(name = "ID_DYNAFORM", referencedColumnName = "ID_DYNAFORM", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Dynaform dynaform;

    public DynaformStage() {
    }

    public DynaformStage(DynaformStagePK dynaformStagePK) {
        this.dynaformStagePK = dynaformStagePK;
    }

    public DynaformStage(Long idDynaform, Long idStage) {
        this.dynaformStagePK = new DynaformStagePK(idDynaform, idStage);
    }

    public DynaformStagePK getDynaformStagePK() {
        return dynaformStagePK;
    }

    public void setDynaformStagePK(DynaformStagePK dynaformStagePK) {
        this.dynaformStagePK = dynaformStagePK;
    }

    public Integer getSecuence() {
        return secuence;
    }

    public void setSecuence(Integer secuence) {
        this.secuence = secuence;
    }
    
    public ParameterDetail getMode() {
		return mode;
	}

	public void setMode(ParameterDetail mode) {
		this.mode = mode;
	}

    public Stage getStage() {
        return stage;
    }

    public void setStage(Stage stage) {
        this.stage = stage;
    }

    public Dynaform getDynaform() {
        return dynaform;
    }

    public void setDynaform(Dynaform dynaform) {
        this.dynaform = dynaform;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (dynaformStagePK != null ? dynaformStagePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof DynaformStage)) {
            return false;
        }
        DynaformStage other = (DynaformStage) object;
        if ((this.dynaformStagePK == null && other.dynaformStagePK != null) || (this.dynaformStagePK != null && !this.dynaformStagePK.equals(other.dynaformStagePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.DynaformStage[ dynaformStagePK=" + dynaformStagePK + " ]";
    }
    
}
